package org.kymjs.kjframe.adapter;

import android.view.View;

import java.util.Calendar;

/**
 * 防止双击的方法
 * Created by tse on 2015/9/25.
 */
public abstract class NoDoubleClickListener implements View.OnClickListener {
    public static final int MIN_CLICK_DELAY_TIME = 100;
    private static long lastClickTime = 0;
    @Override
    public void onClick(View v) {

        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > MIN_CLICK_DELAY_TIME) {
            lastClickTime = currentTime;
            onNoDoubleClick(v);
        }
    }

    protected abstract void onNoDoubleClick(View v);

}